package fr.mmt.gisfizz.init;

import javax.servlet.ServletContextEvent;
import static org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext;
import org.springframework.web.context.ContextLoaderListener;

/**
 * Init listener. <br/>
 *
 * @author Mathieu MAST
 */
public class InitListener extends ContextLoaderListener {

    @Override
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        try {
            InitProcess initProcess = (InitProcess) getCurrentWebApplicationContext().getBean("initProcess");
            initProcess.init();
        } catch (Exception ex) {
            ex.printStackTrace(System.err);
        }
    }
}
